fix: support Jira REST API v3 (v2 fallback)#19
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for Jira REST API v3 with automatic fallback to v2. The implementation defaults to v3 endpoints (specifically /rest/api/3/search/jql for searches) and falls back to v2 when v3 is unavailable. A new apiVersion configuration option allows users to explicitly set the API version (auto, 2, or 3).
Key changes:
- Dual client architecture with separate axios instances for v2 and v3 APIs
- Smart fallback mechanism that switches versions when API endpoints return 404/410 errors
- New
apiVersionconfiguration via config file orJIRA_API_VERSIONenvironment variable
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/jira-client.js | Core client refactored to support dual v2/v3 clients with automatic fallback logic |
| lib/config.js | Added apiVersion configuration field with validation and environment variable support |
| lib/utils.js | Updated URL formatting to handle both v2 and v3 API paths using regex |
| tests/jira-client.test.js | Updated all test mocks to use new clientV2/clientV3 structure and request method |
| README.md | Added documentation for JIRA_API_VERSION environment variable |
| docs/API.md | Updated API documentation to include apiVersion parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 2.3.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18.
/rest/api/3/search/jql) by defaultapiVersionconfig key +JIRA_API_VERSIONenv var (auto|2|3)Tests:
npm test